<template>
    <div class="department" id="department">
      <!-- 左侧部门管理 -->
      <div class="structureTree" v-if="treelength">
        <div class="structureTree_title">
          <div>组织机构</div>
          <div></div>
        </div>
        <tree
          :treeData="treeData"
          :checkData="checkData"
          name="GxBack-softFoundationManage_treeCheck"
          nodeKey="fCompanyid"
          @getTreeInfo="handleNodeClick"
          :defaultProps="defaultProps"
        >
        </tree>
      </div>
      <!-- 右侧 -->
      <div class="department_right">
        <!-- 机构名称 -->
        <el-breadcrumb :title="showName"></el-breadcrumb>
        <!-- 表格 -->
        <div class="warningObject_table">
          <div class="perpsonObject">
            <div class="mechanism_nav">
              <!-- 左侧 -->
              <div class="mechanism_nav_left">
                <input
                  type="text"
                  placeholder="姓名/手机"
                  v-model="lqgetList.keyWord"
                />
                <el-button
                  type="primary"
                  icon="el-icon-search"
                  size="small"
                  @click="yj_searchForm(lqgetList)"
                  >查询
                </el-button>
              </div>
              <!-- 顶部按钮 -->
              <div class="print" style="justify-content: flex-end">
                <!-- <el-button type="primary" icon="el-icon-refresh" size="small" @click="yj_searchForm(lqgetList)">
                                </el-button>
                                <el-button type="primary" v-if="yj_view" icon="el-icon-search" size="small"
                                    @click="yj_editForm(2)">查看
                                </el-button> -->
                <el-button
                  type="primary"
                  v-if="yj_add"
                  icon="el-icon-circle-plus-outline"
                  size="small"
                  @click="yj_editForm(0)"
                >
                  新增</el-button
                >
                <el-button
                  type="primary"
                  v-if="yj_edit"
                  icon="el-icon-edit"
                  size="small"
                  @click="yj_editForm(1)"
                  >编辑
                </el-button>
                <el-button
                  type="primary"
                  icon="el-icon-delete"
                  size="small"
                  @click="yj_delForm(fId)"
                  >删除
                </el-button>
              </div>
            </div>
            <div class="table">
              <tableData
                :height="navigatepageNums > 1 ? 'calc(100% - 50px)' : '100%'"
                :config="table_config"
                :rowKey="rowKey"
                :dataList="tableData"
                :loading="listLoading"
                @selection-change="selectionChange"
                @sort-change="sortChange"
                @click-change="rowChange"
              />
              <pagination
                :info="queryCriteriaData"
                v-if="navigatepageNums > 1"
                :treelength="treelength"
                :total="queryCriteriaData.total"
                :pageNum.sync="lqgetList.page"
                :limit.sync="lqgetList.pageSize"
                @pagination="yj_searchForm(lqgetList)"
              />
            </div>
          </div>
          <div class="departmentObject">
            <div class="mechanism_nav">
              <!-- 左侧 -->
              <div class="mechanism_nav_left"></div>
              <!-- 顶部按钮 -->
              <div class="print" style="justify-content: flex-end">
                <el-button
                  type="primary"
                  icon="el-icon-circle-plus-outline"
                  size="small"
                  @click="yj_editObjectForm(0)"
                >
                  新增</el-button
                >
                <el-button
                  type="primary"
                  icon="el-icon-edit"
                  size="small"
                  @click="yj_editObjectForm(1)"
                  >编辑
                </el-button>
                <el-button
                  type="primary"
                  icon="el-icon-delete"
                  size="small"
                  @click="yj_delObjectForm(warningObjectformData.fId)"
                  >删除
                </el-button>
              </div>
            </div>
            <div class="table1">
              <tableData
                :height="navigatepageNums > 1 ? 'calc(100% - 50px)' : '100%'"
                :config="department_config"
                :rowKey="rowKey"
                :dataList="tableObjectData"
                :loading="listObjectLoading"
                @selection-change="selectionChange"
                @sort-change="sortChange"
                @click-change="rowObjectChange"
              />
            </div>
          </div>
        </div>
        <!--弹框 查看 -->
        <div class="Control-1 mechanism_dialog">
          <el-dialog
            :title="editDialog"
            :modal-append-to-body="false"
            
            :visible.sync="dialogEditVisible"
            v-loading="loadingEditDialog"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.2)"
          >
            <div class="dialogBody common" :style="{ height: '550px' }">
              <!-- <div class="baseTitle">基本信息</div> -->
              <div style="height: 100%">
                <el-form
                  :model="formData"
                  :rules="rules"
                  ref="publicForm"
                  class="demo-ruleForm"
                >
                  <div class="tableRow">
                    <el-form-item
                      label="姓名"
                      prop="fName"
                      :label-width="formLabelWidth"
                    >
                      <el-input
                        v-model="formData.fName"
                        autocomplete="off"
                      ></el-input>
                    </el-form-item>
                    <el-form-item
                      label="是否业主"
                      prop="fIsowner"
                      id="flex-able"
                      :label-width="formLabelWidth"
                    >
                      <el-switch
                        v-model="formData.fIsowner"
                        @change="IsownerChange"
                      >
                      </el-switch>
                    </el-form-item>
                  </div>
                  <div class="tableRow">
                    <!-- :label="`${item.fObjectname}/${item.fEqptno}`" -->
                    <el-form-item
                      label="所属对象"
                      prop="fObjects"
                      :label-width="formLabelWidth"
                    >
                      <!-- multiple -->
                      <el-select
                        placeholder="请选择"
                        v-model="fEquipmentname"
                        value-key="fId"
                        @change="selectEquipmen"
                      >
                        <el-option
                          v-for="(item, index) in ObjectsData"
                          :label="`${item.fObjectname}`"
                          :value="item"
                          :key="index"
                        >
                        </el-option>
                      </el-select>
                    </el-form-item>
                  </div>
  
                  <div class="tableRow">
                    <el-form-item
                      label="手机号"
                      prop="fTelnumber"
                      :label-width="formLabelWidth"
                    >
                      <el-input
                        v-model="formData.fTelnumber"
                        autocomplete="off"
                      ></el-input>
                    </el-form-item>
                    <el-form-item
                      label="钉钉"
                      prop="fNumber"
                      :label-width="formLabelWidth"
                    >
                      <el-input
                        v-model="formData.fNumber"
                        disabled
                        autocomplete="off"
                        placeholder="请输入钉钉"
                      ></el-input>
                    </el-form-item>
                  </div>
                  <div class="tableRow">
                    <el-form-item
                      label="性别"
                      prop="fGender"
                      :label-width="formLabelWidth"
                    >
                      <el-radio v-model="formData.fGender" label="男"
                        >男</el-radio
                      >
                      <el-radio v-model="formData.fGender" label="女"
                        >女</el-radio
                      >
                    </el-form-item>
                    <el-form-item
                      label="接受短信"
                      prop="fIsreceivetextmsg"
                      :label-width="formLabelWidth"
                    >
                      <el-radio v-model="formData.fIsreceivetextmsg" label="是"
                        >是</el-radio
                      >
                      <el-radio v-model="formData.fIsreceivetextmsg" label="否"
                        >否</el-radio
                      >
                    </el-form-item>
                  </div>
  
                  <div class="tableRow">
                    <el-form-item
                      label="职位"
                      prop="fPosition"
                      :label-width="formLabelWidth"
                    >
                      <el-input
                        v-model="formData.fPosition"
                        autocomplete="off"
                      ></el-input>
                    </el-form-item>
                    <el-form-item
                      label="微信"
                      prop="fEducation"
                      :label-width="formLabelWidth"
                    >
                      <el-input
                        v-model="formData.fEducation"
                        disabled
                        autocomplete="off"
                        placeholder="请输入微信"
                      ></el-input>
                    </el-form-item>
                  </div>
                </el-form>
              </div>
            </div>
            <div class="newlyAdded_btn" v-if="submitFlag">
              <el-button type="primary" @click="yj_saveForm('formData')"
                >保存</el-button
              >
              <el-button type="warning" @click="dialogEditVisible = false"
                >关闭</el-button
              >
            </div>
          </el-dialog>
        </div>
        <!-- 对象部门 -->
        <div class="Control-1 bansetting" id="smallDialog">
          <el-dialog
            :title="warningObjectDialog"
            :modal-append-to-body="false"
            
            :visible.sync="dialogwarningObjectVisible"
            v-loading="loadingwarningObjectDialog"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.2)"
          >
            <div class="dialogBody common" :style="{ height: '400px' }">
              <div style="height: 160px">
                <publicForm
                  ref="ObjectForm"
                  lableWidth="60px"
                  :formObj="warningObjectformObj"
                  :formData="warningObjectformData"
                  @selectChange="selectObjectChange"
                >
                </publicForm>
              </div>
            </div>
            <div class="newlyAdded_btn" v-if="submitFlag">
              <el-button type="primary" @click="yj_saveObjectForm('formData')"
                >保存</el-button
              >
              <el-button
                type="warning"
                @click="dialogwarningObjectVisible = false"
                >关闭</el-button
              >
            </div>
          </el-dialog>
        </div>
      </div>
    </div>
  </template>
<script src="./index.js"></script>
    
<style scoped lang="less">
@import "./index.less";
</style>